1 /* 2 * Copyright (c) 2010, Sangoma Technologies 3 * David Yat Sin <dyatsin@sangoma.com> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * * Neither the name of the original author; nor the names of any contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 26 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 * Contributors: 35 * 36 * Moises Silva <moy@sangoma.com> 37 * Ricardo BarroetaveƱa <rbarroetavena@anura.com.ar> 38 * 39 */ 40 41 #ifndef __FTDM_CALL_UTILS_H__ 42 #define __FTDM_CALL_UTILS_H__ 43 44 /*! 45 * \brief Set the Numbering Plan Identification from a string 46 * 47 * \param npi_string string value 48 * \param target the target to set value to 49 * 50 * \retval FTDM_SUCCESS success 51 * \retval FTDM_FAIL failure 52 */ 53 FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *npi_string, uint8_t *target); 54 55 56 /*! 57 * \brief Set the Type of number from a string 58 * 59 * \param ton_string string value 60 * \param target the target to set value to 61 * 62 * \retval FTDM_SUCCESS success 63 * \retval FTDM_FAIL failure 64 */ 65 FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *ton_string, uint8_t *target); 66 67 /*! 68 * \brief Set the Bearer Capability from a string 69 * 70 * \param bc_string string value 71 * \param target the target to set value to 72 * 73 * \retval FTDM_SUCCESS success 74 * \retval FTDM_FAIL failure 75 */ 76 FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *bc_string, uint8_t *target); 77 78 /*! 79 * \brief Set the Bearer Capability - Layer 1 from a string 80 * 81 * \param bc_string string value 82 * \param target the target to set value to 83 * 84 * \retval FTDM_SUCCESS success 85 * \retval FTDM_FAIL failure 86 */ 87 FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *bc_string, uint8_t *target); 88 89 /*! 90 * \brief Set the Screening Ind from a string 91 * 92 * \param screen_string string value 93 * \param target the target to set value to 94 * 95 * \retval FTDM_SUCCESS success 96 * \retval FTDM_FAIL failure 97 */ 98 FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target); 99 100 101 /*! 102 * \brief Set the Presentation Ind from an enum 103 * 104 * \param screen_string string value 105 * \param target the target to set value to 106 * 107 * \retval FTDM_SUCCESS success 108 * \retval FTDM_FAIL failure 109 */ 110 FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target); 111 112 113 /*! 114 * \brief Checks whether a string contains only numbers 115 * 116 * \param number string value 117 * 118 * \retval FTDM_SUCCESS success 119 * \retval FTDM_FAIL failure 120 */ 121 FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number); 122 123 /*! 124 * \brief Set the Calling Party Category from an enum 125 * 126 * \param cpc_string string value 127 * \param target the target to set value to 128 * 129 * \retval FTDM_SUCCESS success 130 * \retval FTDM_FAIL failure 131 */ 132 FT_DECLARE(ftdm_status_t) ftdm_set_calling_party_category(const char *string, uint8_t *target); 133 134 #endif /* __FTDM_CALL_UTILS_H__ */ 135