Map Functions

Map functions change an AVP value to a different MDC field value or an MDC field value to a different AVP value. The MATRIXX Engine uses mapping functions to return results as Diameter result codes.

Map functions are defined before an <avp> element after the mdc_field_name attribute. For example:
<avp name="TextAVP"
	mdc_field_name="NumberField"
	map_function="AvpNames_Ids"
		avp_type="string" mdc_field_type="int32"
		default_avp_value="Unknown" default_mdc_field_value="6"
		<map avp_value="Red"    mdc_field_value="1"/>
		<map avp_value="Green"  mdc_field_value="2"/>
		<map avp_value="Blue"   mdc_field_value="3"/>
		<map avp_value="Gold"   mdc_field_value="4"/>
		<map avp_value="Silver" mdc_field_value="5"/>
<avp/>

In this example, if the map function is defined in a <request> element, the TextAVP avp_value is looked up in this map and the NumberField MDC field is set with the associated value. if the map function is defined in an <answer> element, then the NumberField MDC field is looked up in reverse of this map and the TextAVP AVP's value is set with the associated value. If there is no match, then a default_* value is used if specified. If a default_* value is not specified, an error is logged.

For a list of Diameter result codes, see Diameter result codes.