> For the complete documentation index, see [llms.txt](https://docs.atfinity.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atfinity.io/rule-language/operators/special-operators/country_to_phone_prefix.md).

# COUNTRY\_TO\_PHONE\_PREFIX

### Description

`COUNTRY_TO_PHONE_PREFIX` returns the international telephone calling code for a given ISO 3166-1 country code, as a string prefixed with `+`. Both alpha-2 (2-letter) and alpha-3 (3-letter) codes are accepted.

Returns `unknown` if the input is not a recognised country code.

### Syntax

```
COUNTRY_TO_PHONE_PREFIX(country_code)
```

**Returns:** A string such as `'+41'`, or `unknown` if the input is unrecognised.

### Example

```
COUNTRY_TO_PHONE_PREFIX('CH')
```

This returns `'+41'`.

```
COUNTRY_TO_PHONE_PREFIX('CHE')
```

This also returns `'+41'`.

```
COUNTRY_TO_PHONE_PREFIX('US')
```

This returns `'+1'`.

```
COUNTRY_TO_PHONE_PREFIX('XX')
```

This returns `unknown` — `'XX'` is not a valid ISO country code.

### Example in context

```
p is Person
CONCAT(COUNTRY_TO_PHONE_PREFIX(p.country), p.local_phone_number)
```

Combines the calling prefix for the person's country with their local number to produce a full international phone number, e.g. `'+41791234567'`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/special-operators/country_to_phone_prefix.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
